import { BaseEntity } from './base.entity'
import { Entity, Column, ManyToOne, OneToMany, JoinColumn } from 'typeorm'
import { ProductSkuEntity } from './productSkuEntity.entity'

@Entity('product')
export class ProductEntity extends BaseEntity {
  @Column()
  name: string

  @Column()
  tab_name: string

  @Column('text')
  img_url: string

  @Column('text')
  brief: string

  @Column('decimal')
  price: number

  @Column('decimal')
  org_price: number

  @Column({
    default: false,
  })
  show_price_qi: Boolean

  @Column({
    type: 'text',
    comment: '商品分类列表',
  })
  k_ids: string

  @OneToMany(
    () => ProductSkuEntity,
    productSkuEntity => productSkuEntity.product,
  )
  productSku: ProductSkuEntity[]
}
